package com.springboot.wisdom.log.domain.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.springboot.wisdom.common.common.constant.LogStatusEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 *
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "tb_log")
public class LogDO implements Serializable {
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    /**
     *
     */
    @TableId(type = IdType.ASSIGN_ID)
    private String logId;

    /**
     *
     */
    @ApiModelProperty(value = "更新时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "Asia/Shanghai")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date operationTime;

    /**
     *
     */
    private String userId;
    /**
     *
     */
    private String userName;

    /**
     *
     */
    private String operationType;

    /**
     *
     */
    private String details;


    private String ipAddress;

    /**
     *
     */
//    @TableLogic
//    private Integer isdeleted;
    public String getOperationType() {
        return LogStatusEnum.findEnumByIndexToString(this.operationType);
    }
}
